package com.mangguo.tingjian.content.service.impl;

import com.mangguo.tingjian.content.entity.DwAudio;
import com.mangguo.tingjian.content.mapper.DwAudioMapper;
import com.mangguo.tingjian.content.service.IDwAudioService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 音频同步表 服务实现类
 * </p>
 *
 * @author auto
 * @since 2019-11-24
 */
@Service
@AllArgsConstructor
public class DwAudioServiceImpl extends ServiceImpl<DwAudioMapper, DwAudio> implements IDwAudioService {

    private final DwAudioMapper dwAudioMapper;

    @Override
    public Long countAudioBetweenDate(Integer start, Integer end) {
        return dwAudioMapper.countAudioBetweenDate(start, end);
    }

    @Override
    public Long countAudioAll() {
        return dwAudioMapper.countAudioAll();
    }

    @Override
    public Long sumAudioDurationBetweenDate(Integer start, Integer end) {
        Long sum = dwAudioMapper.sumAudioDurationBetweenDate(start, end);
        if (sum == null){
            return 0L;
        }
        return sum;
    }

    @Override
    public Long sumAudioDurationAll() {
        Long sum = dwAudioMapper.sumAudioDurationAll();
        if (sum == null){
            return 0L;
        }
        return sum;
    }

    @Override
    public Long countAlbumBetweenDate(Integer start, Integer end) {
        return dwAudioMapper.countAlbumBetweenDate(start, end);
    }

    @Override
    public Long countAlbumAll() {
        return dwAudioMapper.countAlbumAll();
    }

    @Override
    public List<String> queryAudioNameLike(String name) {
        return dwAudioMapper.queryAudioNameLike("%" + name + "%");
    }

    @Override
    public List<String> queryAlbumNameLike(String name) {
        return dwAudioMapper.queryAlbumNameLike("%" + name + "%");
    }

    @Override
    public List<String> queryAuthorNameLike(String name) {
        return dwAudioMapper.queryAuthorNameLike("%" + name + "%");
    }

    @Override
    public List<String> queryCmoNameLike(String name) {
        return dwAudioMapper.queryCmoNameLike("%" + name + "%");
    }
}
